package org.snail.proxy.proto;

import java.util.Arrays;

public class Packet {
    private final byte head;
    private final long sid;
    private final int cmd;
    private final byte[] bytes;

    public Packet(byte head, int cmd, byte[] bytes) {
        this(head, (short)0, cmd, bytes);
    }

    public Packet(byte head, long sid, int cmd, byte[] bytes){
        this.head = head;
        this.sid = sid;
        this.cmd = cmd;
        this.bytes = bytes;
    }

    public byte getHead() {
        return this.head;
    }

    public int getCmd() {
        return this.cmd;
    }

    public byte[] getBytes() {
        return this.bytes;
    }

    public long getSid() {
        return this.sid;
    }

    @Override
    public String toString() {
        return "Packet{" +
                "head=" + head +
                ", sid=" + sid +
                ", cmd=" + cmd +
                ", bytes=" + Arrays.toString(bytes) +
                '}';
    }
}
